//
//  ViewController.swift
//  testColor
//
//  Created by 王渊鸥 on 16/9/18.
//  Copyright © 2016年 王渊鸥. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
	@IBOutlet weak var v1: UIView!
	@IBOutlet weak var v2: UIView!
	@IBOutlet weak var v3: UIView!
	@IBOutlet weak var red: UISlider!
	@IBOutlet weak var green: UISlider!
	@IBOutlet weak var blue: UISlider!

	override func viewDidLoad() {
		super.viewDidLoad()
		// Do any additional setup after loading the view, typically from a nib.
		
		v1.backgroundColor = UIColor(colorLiteralRed: 0.5, green: 0.5, blue: 0.5, alpha: 1)
		v2.backgroundColor = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1)
		v3.backgroundColor = UIColor(displayP3Red: 0.5, green: 0.5, blue: 0.5, alpha: 1)
		
	}

	override func didReceiveMemoryWarning() {
		super.didReceiveMemoryWarning()
		// Dispose of any resources that can be recreated.
	}
	
	@IBAction func updateColor(_ sender: UISlider) {
		v1.backgroundColor = UIColor(colorLiteralRed: red.value, green: green.value, blue: blue.value, alpha: 1)
		v2.backgroundColor = UIColor(red: CGFloat(red.value), green: CGFloat(green.value), blue: CGFloat(blue.value), alpha: 1)
		v3.backgroundColor = UIColor(displayP3Red: CGFloat(red.value), green: CGFloat(green.value), blue: CGFloat(blue.value), alpha: 1)
	}
}

